﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace PracticeProject
{
    public partial class SetingToDoneActivity : Form
    {
        public SetingToDoneActivity()
        {
            InitializeComponent();
        }

        public bool ShowToSetDate(Activity act)
        {
            if (ShowDialog() == DialogResult.OK)
            {
                try
                {
                    DateTime date = DTDate.Value.Date;
                    date += DTTime.Value.TimeOfDay;
                    if (date < act.StartingTime)
                        throw new Exception();
                    act.SetToDone(date);
                    return true;
                }
                catch
                {
                    MessageBox.Show("Ending time is equel or less then starting time", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                }
            }
            return false;

        }

        private void button1_Click(object sender, EventArgs e)
        {

        }

        private void SetingToDoneActivity_Load(object sender, EventArgs e)
        {

        }
    }
}